#pragma once

#include "Part.h"

class WelfarePart : public Part
{

public:
	WelfarePart();
	virtual ~WelfarePart();
public:
	virtual bool		Init(Creature *pMaster, uint32_t partType, CharacterDBInfo* pCharacterDB = nullptr);
	virtual bool		UnInit();
	virtual bool		OnMsgHandle(uint32_t cmd, const char* data, uint32_t len);
	virtual void		OnExecute(uint16_t nEventID, uint64_t nSrcID, uint8_t bySrcType, void *pContext, int32_t nLen){}
	virtual void		OnTimer(uint32_t nTimerID){}

	virtual bool		SaveDB(CharacterDBInfo& characterDB);

	virtual void		Update(uint64_t tick){}

	//每周零点更新
	virtual bool		WeekUpdate(uint64_t unixSec);

private:
	bool				HandleOnSignReq(const char* data, uint32_t len);
	bool				HandleSignInfo(const char* data, uint32_t len);

private:
	void				SendSignInfo();
	void				RefreshSignInfo();
	uint32_t			CurWeekFromOpen();//获取从开服到当前的周数

private:
	//签到数据
	uint32_t			mSignRecord;
	uint32_t			mSignReward;
	//uint32_t			mSignRewardCount; //奖励周期
	uint32_t			mSignRefreshTime;	//上一次签到的时间
};
